<!DOCTYPE html>
<html lang="zh_cn">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script>
    window.onload = () => {
      const filterObjectProperties = (obj, propArray) => {
        Object.keys(obj).forEach((key) => !propArray.includes(key) && delete obj[key])
      }

      const propArray = ['operatorId', 'groupId', 'startDate', 'endDate']

      const obj = {
        operatorId: 1,
        groupId: 2,
        a: 3,
        b: 4
      }

      console.log('before', JSON.stringify(obj))
      filterObjectProperties(obj, propArray)
      console.log('after', JSON.stringify(obj))
    }
  </script>
</head>
<body>
  
</body>
</html>